package com.pf.java;

import java.io.IOException;
import java.util.Properties;

/**
 * 处理属性文件
 *
 * @author pf
 * @data 2021/11/1-14:26
 */
public class properties {

    public static void main(String[] args) {

        Properties properties = new Properties();
        try {
            properties.load(properties.class.getClassLoader()
                                .getResourceAsStream("resources/db.properties"));

            String un = properties.getProperty("username");
            String pw = properties.getProperty("password");

            System.out.println(un + " , " + pw);
        } catch (IOException e) {
            throw new RuntimeException("加载资源文件失败", e);
        }

    }
}
